<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>index16-Generator</title>
</head>
<body>
  <script type="text/javascript">

    function* myGenerator(){
      console.log("业务逻辑A");
      yield 'hello';
      console.log("业务逻辑B");
      yield 'world';
    }
    let mg = myGenerator();
    // let r1 = mg.next();
    // console.log(r1);
    // let r2 = mg.next();
    // console.log(r2);
    // let r3 = mg.next();
    // console.log(r3);
  </script>
</body>
</html>